//
//  ScanZhuangXiangGoodCell.m
//  ReceiptDelivery
//
//  Created by 吕晶 on 2020/11/12.
//  Copyright © 2020 吕晶. All rights reserved.
//

#import "ScanZhuangXiangGoodCell.h"

@interface ScanZhuangXiangGoodCell ()

@property (nonatomic, strong) UILabel *masterLab;
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UILabel *NOTitleLab;
@property (nonatomic, strong) UILabel *NOLab;
@property (nonatomic, strong) UILabel *nameTitleLab;
@property (nonatomic, strong) UILabel *nameLab;
@property (nonatomic, strong) UILabel *countTitleLab;
@property (nonatomic, strong) UILabel *countLab;
@property (nonatomic, strong) UILabel *capacityTitleLab;
@property (nonatomic, strong) UILabel *capacityLab;

@end

@implementation ScanZhuangXiangGoodCell

+ (instancetype)ScanZhuangXiangGoodCellWithTableView:(UITableView *)tableView {
    static NSString *cellID = @"ScanZhuangXiangGoodCell";
    ScanZhuangXiangGoodCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[ScanZhuangXiangGoodCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = Color_backgroundColor;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.masterLab = [[UILabel alloc] initWithFrame:CGRectMake(15, 20, ScreenW - 30, 17)];
        self.masterLab.textColor = HexColor(0x333333);
        self.masterLab.font = BoldFontOfSize(16);
        [self.contentView addSubview:self.masterLab];
        
        self.bgView = [[UIView alloc] initWithFrame:CGRectMake(15, self.masterLab.nim_bottom + 10, ScreenW - 30, 125)];
        self.bgView.backgroundColor = HexColor(0xffffff);
        self.bgView.layer.masksToBounds = YES;
        self.bgView.layer.cornerRadius = 6;
        [self.contentView addSubview:self.bgView];
        
        self.NOTitleLab = [[UILabel alloc] initWithFrame:CGRectMake(15, 15, [FactoryMethod sizeWithText:@"货物编号：" font:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(0, 0)].width, [FactoryMethod sizeWithText:@"货物编号：" font:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(0, 0)].height)];
        self.NOTitleLab.textColor = HexColor(0x585974);
        self.NOTitleLab.font = [UIFont systemFontOfSize:14];
        self.NOTitleLab.text = @"货物编号：";
        [self.bgView addSubview:self.NOTitleLab];
        
        self.NOLab = [[UILabel alloc] initWithFrame:CGRectMake(self.NOTitleLab.nim_right, self.NOTitleLab.nim_top, self.bgView.nim_width - 15 - self.NOTitleLab.nim_right, self.NOTitleLab.nim_height)];
        self.NOLab.textColor = Color_ThemeColor;
        self.NOLab.font = [UIFont systemFontOfSize:14];
        self.NOLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.NOLab];
        
        self.nameTitleLab = [[UILabel alloc] initWithFrame:CGRectMake(15, 10 + self.NOTitleLab.nim_bottom, [FactoryMethod sizeWithText:@"货物名称：" font:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(0, 0)].width, [FactoryMethod sizeWithText:@"货物名称：" font:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(0, 0)].height)];
        self.nameTitleLab.textColor = HexColor(0x585974);
        self.nameTitleLab.font = [UIFont systemFontOfSize:14];
        self.nameTitleLab.text = @"货物名称：";
        [self.bgView addSubview:self.nameTitleLab];
        
        self.nameLab = [[UILabel alloc] initWithFrame:CGRectMake(self.nameTitleLab.nim_right, self.nameTitleLab.nim_top, self.bgView.nim_width - 15 - self.nameTitleLab.nim_right, self.nameTitleLab.nim_height)];
        self.nameLab.textColor = HexColor(0x2B2C44);
        self.nameLab.font = [UIFont systemFontOfSize:14];
        self.nameLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.nameLab];
        
        self.countTitleLab = [[UILabel alloc] initWithFrame:CGRectMake(self.nameTitleLab.nim_left, self.nameTitleLab.nim_bottom + 10, [FactoryMethod sizeWithText:@"货物数量：" font:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(0, 0)].width, [FactoryMethod sizeWithText:@"货物数量：" font:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(0, 0)].height)];
        self.countTitleLab.textColor = HexColor(0x585974);
        self.countTitleLab.font = [UIFont systemFontOfSize:14];
        self.countTitleLab.text = @"货物数量：";
        [self.bgView addSubview:self.countTitleLab];
        
        self.countLab = [[UILabel alloc] initWithFrame:CGRectMake(self.countTitleLab.nim_right, self.countTitleLab.nim_top, self.bgView.nim_width - 15 - self.countTitleLab.nim_right, self.countTitleLab.nim_height)];
        self.countLab.textColor = HexColor(0x2B2C44);
        self.countLab.font = [UIFont systemFontOfSize:14];
        self.countLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.countLab];
        
        self.capacityTitleLab = [[UILabel alloc] initWithFrame:CGRectMake(self.countTitleLab.nim_left, self.countTitleLab.nim_bottom + 10, [FactoryMethod sizeWithText:@"收容数：" font:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(0, 0)].width, [FactoryMethod sizeWithText:@"收容数：" font:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(0, 0)].height)];
        self.capacityTitleLab.textColor = HexColor(0x585974);
        self.capacityTitleLab.font = [UIFont systemFontOfSize:14];
        self.capacityTitleLab.text = @"收容数：";
        [self.bgView addSubview:self.capacityTitleLab];
        
        self.capacityLab = [[UILabel alloc] initWithFrame:CGRectMake(self.capacityTitleLab.nim_right, self.capacityTitleLab.nim_top, self.bgView.nim_width - 15 - self.capacityTitleLab.nim_right, self.capacityTitleLab.nim_height)];
        self.capacityLab.textColor = HexColor(0x2B2C44);
        self.capacityLab.font = [UIFont systemFontOfSize:14];
        self.capacityLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.capacityLab];
        
        self.height = self.bgView.nim_bottom;
    }
    return self;
}

-(void)setModel:(ScanZhuangXiangGoodModel *)model {
    _model = model;
    self.masterLab.text = [NSString stringWithFormat:@"货主：%@",model.s_name];
    self.NOLab.text = model.pro_num;
    self.nameLab.text = model.name;
    self.countLab.text = model.num;
    self.capacityLab.text = model.take_num;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
